package com.hr.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hr.dao.WageDao;
import com.hr.model.WageModel;
import com.hr.service.WageService;
@Service
public class WageServiceImpl implements WageService {
	@Autowired
	private WageDao wageDao;
	@Override
	public List<WageModel> findAll() {
		return wageDao.findAll();
	}
	
	@Override
	public boolean editWage(WageModel wageModel) {
		if(wageModel!=null)
			wageDao.addWage(wageModel);
		return true;
	}

	@Override
	public String checkWageHaveSend(String user_id, String wage_date) {
		String returnStr="false";
		boolean result  = wageDao.checkWageHaveSend(user_id, wage_date);
		if(result)
			returnStr="true";
		return returnStr;
	}

	@Override
	public List<WageModel> findByUserId(String user_id) {
		if(user_id==null||"".equals(user_id.trim()))
			return null;
		return wageDao.findByUserId(user_id);
	}

	@Override
	public void deleteWage(String user_id, String wage_date) {
		if(user_id==null||wage_date==null)
			return;
		wageDao.deleteWage(user_id, wage_date);
	}


}
